package com.dublbo.addressbook.frame.person;

import com.dublbo.addressbook.frame.CPersonMainPanel;
import com.dublbo.addressbook.util.FileOperation;
import com.dublbo.jpSwing.JpToaster;
import com.dublbo.jpSwing.thread.JpShortTask;

public class CPersonExportTask extends JpShortTask {
    private CPersonMainPanel ui;

    public CPersonExportTask(CPersonMainPanel ui) {
        this.ui = ui;
    }

    @Override
    protected void doInBackground() throws Exception {
        String exportPath = (String) this.args[0];
        FileOperation.exportCPerson(exportPath);
    }

    @Override
    protected void done() {
        if (this.err != null) {
            JpToaster.show(this.ui, JpToaster.ERROR, this.err.getMessage());
            return;
        }
        JpToaster.show(this.ui,JpToaster.INFO,"通讯录已成功导出！");
    }
}
